package com.gh.controller;

import com.gh.entity.CommonResult;
import com.gh.entity.Payment;
import com.gh.service.PaymentFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author Eric
 * @Date 2021/7/31 12:27
 * @Version 1.0
 */
@RestController
@Slf4j
public class PaymentController {
    @Autowired
    private PaymentFeignService paymentFeignService;

    @PostMapping("consumer/payment/create")
    public CommonResult create(@RequestBody Payment payment){
        CommonResult commonResult = paymentFeignService.create(payment);
        return commonResult;
    }

    @GetMapping("consumer/payment/get/{id}")
    public CommonResult getPaymentById(@PathVariable("id") Long id){
        CommonResult commonResult = paymentFeignService.getPaymentById(id);
        return commonResult;
    }
    @GetMapping("consumer/payment/feign/timeout")
    public String feignTimeout(){
        String result = paymentFeignService.feignTimeout();
        return result;
    }
}
